<html xmlns:fb="http://www.facebook.com/2008/fbml">
    <body>
        <script src="http://connect.facebook.net/en_US/all.js"></script>
        <div id="fb-root"></div>
        <script>
            // assume we are already logged in
            FB.init({appId: '106718279433830', xfbml: true, cookie: true, oauth: true});
            
            function logintofacebook(){
                FB.login(function(response) {
                    if (response.authResponse) {
                        console.log('Welcome!  Fetching your information.... ');
                        FB.api('/me', function(response) {
                            console.log('Good to see you, ' + response.name + '.');
                            FB.logout(function(response) {
                                console.log('Logged out.');
                            });
                        });
                    } else {
                        console.log('User cancelled login or did not fully authorize.');
                    }
                }, {scope: 'email'});
            }                        
        </script>
        <input type="button" onclick="logintofacebook()" value="login" />
    </body>
</html>
